package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.common.utils.BeanUtils;
import com.tianji.learning.domain.dto.QuestionFormDTO;
import com.tianji.learning.domain.po.InteractionQuestion;
import com.tianji.learning.domain.po.LearningLesson;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.domain.vo.QuestionVO;
import com.tianji.learning.query.QuestionAdminPageQuery;
import com.tianji.learning.query.QuestionPageQuery;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.patterns.TypePatternQuestions;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author gml
 * @since 2024-06-25
 */
@Slf4j
@Api(tags = "管理端互动提问的问题表接口")
@RestController
@RequestMapping("/admin/questions")
@RequiredArgsConstructor
public class AdminInteractionQuestionController {
    private final IInteractionQuestionService interactionQuestionService;

    @GetMapping("/page")
    @ApiOperation("分页条件查询互动提问的问题")
    public PageDTO<QuestionAdminVO> getQuestionPage(QuestionAdminPageQuery query) {
        return interactionQuestionService.getAdminQuestionPage(query);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据id查询互动提问的问题")
    public QuestionAdminVO getQuestionById(@PathVariable("id") @ApiParam("问题id") Long id) {
        return interactionQuestionService.getAdminQuestionById(id);
    }

    @PutMapping("/{id}/hidden/{hidden}")
    @ApiOperation("修改互动提问的问题是否隐藏")
    public void updateQuestion(@PathVariable("id") @ApiParam("问题id") Long id,
                               @PathVariable("hidden") @ApiParam("是否隐藏") Boolean hidden){
        interactionQuestionService.updateHidden(id, hidden);
    }
}


